package gef.tutorial.step.app;

import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

    public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
        super(configurer);
    }
    
    /**
     * 1.创建一个新的action bar advisor
     *      指定由ApplicationActionBarAdvisor来配置窗口的操作条。
     */
    @Override
    public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
        return new ApplicationActionBarAdvisor(configurer);
    }
    
    
    /**
     * 2.在窗口打开之前执行
     */
    @Override
    public void preWindowOpen() {
        IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        //1.设置窗口初始化大小
        configurer.setInitialSize(new Point(700, 550));
        
        //2.显示工具栏
        configurer.setShowCoolBar(true);
        
        //3.不显示状态栏
        configurer.setShowStatusLine(false);
        
        //4.设置窗口标题
        configurer.setTitle("GEF入门实例"); //$NON-NLS-1$
    }
}
